package me.xuym.crawler.house58;

import me.xuym.crawler.simpleextension.dispatcher.SimpleDebugDispatcherInput;
import me.xuym.crawler.simpleextension.filter.SimpleCachedFilterInput;

import java.util.Hashtable;
import java.util.Map;

/**
 * Created by broche on 05/08/2017.
 */
public class House58Result implements SimpleDebugDispatcherInput, SimpleCachedFilterInput {
    private String url;
    private String image;
    private String title;
    private String description;
    private String address;
    private String addressdetail;
    private double size;
    private String publisher;
    private double totalprice;
    private double unitprice;
    private String datestamp;
    private long timestamp = System.currentTimeMillis() / 1000;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getAddressdetail() {
        return addressdetail;
    }

    public void setAddressdetail(String addressdetail) {
        this.addressdetail = addressdetail;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public double getTotalprice() {
        return totalprice;
    }

    public void setTotalprice(double totalprice) {
        this.totalprice = totalprice;
    }

    public double getUnitprice() {
        return unitprice;
    }

    public void setUnitprice(double unitprice) {
        this.unitprice = unitprice;
    }

    public String getDatestamp() {
        return datestamp;
    }

    public void setDatestamp(String datestamp) {
        this.datestamp = datestamp;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String simpleDebugDispatcherContent() {
        return title;
    }

    @Override
    public Map<String, String> simpleCachedFilterCheckFields() {
        Map<String, String> fields = new Hashtable<>();
        fields.put("title", getTitle());
        fields.put("addressdetail", getAddressdetail());
        return fields;
    }

    @Override
    public Map<String, String> simpleCachedFilterSaveFields() {
        Map<String, String> fields = new Hashtable<>();
        fields.put("url", getUrl());
        fields.put("image", getImage());
        fields.put("title", getTitle());
        fields.put("description", getDescription());
        fields.put("address", getAddress());
        fields.put("addressdetail", getAddressdetail());
        fields.put("publisher", getPublisher());
        fields.put("totalprice", getTotalprice() + "");
        fields.put("unitprice", getUnitprice() + "");
        fields.put("size", getSize() + "");
        fields.put("datestamp", getDatestamp());
        fields.put("timestamp", getTimestamp() + "");
        return fields;
    }
}
